home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / gs_ccfnt.ps < prev    next >
Text File  |  1996-01-10  |  3KB  |  94 lines

  1. %    Copyright (C) 1994, 1995 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Find and register all the precompiled font operators in systemdict.
  16.  
  17. /registerfont            % <fontname> <fontdict> registerfont <font>
  18.  { DEBUG { (Registering ) print 1 index = } if
  19.    dup begin
  20.      Encoding type /nametype eq
  21.       { Encoding .findencoding /Encoding exch def
  22.       }
  23.      if
  24.      dup /PrefEnc known
  25.       { PrefEnc type /nametype eq
  26.      { PrefEnc .findencoding /PrefEnc exch def
  27.      }
  28.     if
  29.       }
  30.      if
  31.      dup /FDepVector known
  32.       { /FDepVector [ FDepVector
  33.      { FontDirectory 1 index .knownget
  34.         { exch pop }
  35.         { ccfonts 1 index .knownget
  36.            { registerfont
  37.            }
  38.            { Fontmap 1 index known
  39.           { findfont }
  40.           { pop NullFont }
  41.          ifelse
  42.            }
  43.           ifelse
  44.         }
  45.        ifelse
  46.      }
  47.     forall ] readonly def
  48.       }
  49.      if
  50.    end
  51.    % Use the value of definefont appropriate at run-time, not bind-time
  52.    /definefont load exec
  53.  } bind odef
  54. % Bind recursive call (bind descends into oparrays: feature!)
  55. /registerfont dup load bind def
  56.  
  57. /.loadinitialfonts {
  58.    //.loadinitialfonts exec
  59.    /ccfonts mark
  60.      0 1 null .getccfont 1 sub { .getccfont dup /FontName get exch } for
  61.    .dicttomark def
  62.    ccfonts
  63.     { FontDirectory 2 index known { pop pop } { registerfont pop } ifelse }
  64.    forall
  65.   currentdict /ccfonts undef
  66. } bind def
  67.  
  68. currentdict /registerfont undef
  69.  
  70.  
  71. % If we're in a Level 2 system but running in Level 1 mode,
  72. % register the fonts explicitly as resources.
  73. % This is a bit of a hack, but doing better is too much work.
  74.  
  75. /level2dict where
  76.  { pop /findresource where
  77.     {        % Level 2 system, Level 2 mode
  78.       pop
  79.     }
  80.     {        % Level 2 system, Level 1 mode
  81.       /Font /Category level2dict /findresource get exec begin
  82.       FontDirectory
  83.        { dup .gcheck { Instances } { LocalInstances } ifelse
  84.      3 1 roll [exch 0 -1] .growput
  85.        }
  86.       forall end
  87.     }
  88.    ifelse
  89.  }
  90. if
  91.